package com.jrzh.mvc.search.sys;

import org.apache.commons.lang.StringUtils;

import com.jrzh.framework.base.search.BaseSearch;
import com.jrzh.framework.searchutils.Criteria;
import com.jrzh.framework.searchutils.Restrictions;

public class I18nSearch extends BaseSearch{

	private static final long serialVersionUID = 1777046588835211176L;
	
	private String likeModel;
	
	private String likeCode;

	public String getLikeModel() {
		return likeModel;
	}

	public void setLikeModel(String likeModel) {
		this.likeModel = likeModel;
	}

	public String getLikeCode() {
		return likeCode;
	}

	public void setLikeCode(String likeCode) {
		this.likeCode = likeCode;
	}

	@Override
	public void setCriterias(Criteria<?> criterias) {
		if(StringUtils.isNotBlank(likeModel)) {
			criterias.add(Restrictions.like("model", "%" + likeModel + "%"));
		}
		if(StringUtils.isNotBlank(likeCode)) {
			criterias.add(Restrictions.like("code", "%" + likeCode + "%"));
		}
	}

}
